home *** CD-ROM | disk | FTP | other *** search
/ Joystick Magazine 1995 July & August / cd No4 joystick No62.iso / pc / cadeaux / df / doc / df_specs.doc < prev    next >
Encoding:
Text File  |  1995-06-01  |  41.0 KB  |  1,174 lines

  1. +===========================+
  2. | DARK FORCES SPECS v 1.00  |
  3. +===========================+
  4.  
  5. Author : Yves BORCKMANS (yborckmans@abcomp.be (work))
  6.          (Please state the package version when you email me)
  7. Credits: Serge DEBROEYER
  8.                for adjoin/mirror tips, some flags, some INF tips,
  9.                    complex sectors errors, ...
  10.          Don SIELKE (DSielke@aol.com)
  11.                for the complete flags list, the -u option, ...
  12.          Florian ENGELHARDT (100442.2012@compuserve.com)
  13.                for information on GMD files
  14.  
  15.    +------------------------------------------------------------------------+
  16.    | Dark Forces is (c) LucasArts Entertainment Company                     |
  17.    | DOOM        is (c) iD Software                                         |
  18.    |                                                                        |
  19.    | None of these have anything to do with these totally unofficial specs, |
  20.    | and shouldn't be bothered with them in any way.                        |
  21.    +------------------------------------------------------------------------+
  22.  
  23. Welcome to the "DARK FORCES SPECS" !
  24.  
  25. As you will rapidly see, there are still a lot of unknown things in these specs.
  26. But as they are diminishing very quickly, I found it was time to write them
  27. down in a "formal" way, which can serve as a reference.
  28.  
  29. As always, nothing is as good as seeing how professionnals do it, so don't
  30. hesitate to go and see how the LucasArt team did it.
  31.  
  32. I will also try to explain differences with DOOM level making where applicable,
  33. so if you have experience in that domain, look for the DOOM markings.
  34.  
  35. Note : I will frequently use the following abbreviations
  36.  - DF  = Dark Forces
  37.  - LEC = LucasArts Entertainment Company
  38.  - SC  = sector
  39.  - WL  = wall
  40.  - VX  = vertex
  41.  - OB  = object
  42.  - TX  = texture
  43.  
  44. Changes since previous release have been marked [NEW].
  45.  
  46. +-------------------+
  47. | TABLE of CONTENTS |
  48. +-------------------+
  49.  
  50.   0. GENERAL DESCRIPTION
  51.   1. GOB FILES
  52.   2. LEV FILES
  53.      2.1 Basics
  54.      2.2 File Description
  55.   3. FLAGS
  56.      3.1 Sector Flags
  57.      2.3 Wall Flags
  58.   4. INF FILES
  59.   5. GOL FILES
  60.   6. O   FILES
  61.      6.1 Basics
  62.      6.2 File Description
  63.   7. PAL FILES
  64.   8. CMP FILES
  65.   9. BM  FILES
  66.  10. FME FILES
  67.  11. WAX FILES
  68.  12. 3DO FILES
  69.  13. VOC FILES
  70.  14. GMD FILES  [NEW]
  71.  15. MSG FILES
  72.  16. CHEAT CODES
  73.  
  74. +-------------------------+
  75. |  0. GENERAL DESCRIPTION |
  76. +-------------------------+
  77.  
  78. Dark Forces contains a huge amount of files, and these are grouped by type in
  79. what are called GOB files. These are quite similar in principle to DOOM WAD
  80. files, but at a higher level. They serve as containers for other files which
  81. in turn contain information. DOOM WADS directly contain the information.
  82.  
  83. These files can be extracted from the GOB and worked upon, then be used in the
  84. game.
  85. LEC made a very good job at this :
  86.  1. if you place a file in your game directory, DF will take it there before
  87.     looking for it in its GOB.
  88.  2. if you launch DF with the -u option, it will look into the specified .gob
  89.     ( dark -umylevel.gob ). This is probably the best method to distribute
  90.     levels.
  91.  
  92. A very important file "JEDI.LVL" contains the names of all the levels in the
  93. game. Sadly, editing it doesn't work further than the briefing because the
  94. level names are hardcoded in dfbrief.lfd .
  95. What you CAN do however is change the levels titles there.
  96.  
  97. The levels themselves are each one composed of 6 files, found in dark.gob .
  98.  - name.LEV : geometry (static)      (DOOM SECTORS, LINEDEFS/SIDEDEFS, VERTEXES)
  99.  - name.INF : workings (dynamic)     (no DOOM equivalent except the TAG concept)
  100.  - name.GOL : goals                  (no DOOM equivalent)
  101.  - name.O   : objects                (DOOM THINGS)
  102.  - name.PAL : palette                (DOOM PLAYPAL 0 (not the 'hit' palettes))
  103.  - name.CMP : palette mappings       (DOOM COLORMAP)
  104.  
  105. Textures are stored in .BM  files, as are the weapons display, and so on.
  106. Sounds   are stored in .VOC files (normal Creative Labs format).
  107.  
  108. Objects  are stored in the following files depending on their type :
  109.  - obj.3DO  : 3D object (real 3D)
  110.  - obj.FME  : FRAME     (a "one view" object)
  111.  - obj.WAX  : SPRITE    (ie all the ennemies)
  112.  - obj.VOC  : SOUND     (any sound)
  113.  
  114. There are many other inexplored files, including but not limited to :
  115.  - briefings
  116.  - cutscenes
  117.  - fonts
  118.  - vues (in level animations : ie your vessel landing)
  119.  
  120. The following text will now become "quite technical" ...
  121.  
  122.  
  123. +----------------+
  124. |  1. GOB FILES  |
  125. +----------------+
  126.  
  127. GOB files are a repository for many other files. They contain a header with a
  128. signature, a data part and an index part.
  129.  
  130. Their structure follows :
  131.   +------------------------------------------------------------------------+
  132.   | 0000   GOB_MAGIC   char[4]      is 'GOB' followed by 0x0A              |
  133.   | 0004 +-MASTERX     long         offset to MASTERN                      |
  134.   |      |                          MASTERX+4 is the offset of FILE1 data  |
  135.   | 0008 | FILE1       bytes        data for FILE1                         |
  136.   | xxxx | FILE2       bytes        data for FILE2                         |
  137.   | .... |                          ...                                    |
  138.   | xxxx | FILEn       bytes        data for FILEn                         |
  139.   | yy   +>MASTERN     long         number of files in the GOB             |
  140.   | yy+4   INDEX1      GOB_INDEX    index to FILE1                         |
  141.   | yy+25  INDEX2      GOB_INDEX    index to FILE2                         |
  142.   | ....                            ...                                    |
  143.   | zzzz   INDEXn      GOB_INDEX    index to FILEn                         |
  144.   +------------------------------------------------------------------------+
  145.  
  146. The GOB_INDEX format is :
  147.   +------------------------------------------------------------------------+
  148.   | 0000   IX          long         offset of the start of the file        |
  149.   | 0003   LEN         long         lenght of the file                     |
  150.   | 0007   NAME        char[13]     name of the file                       |
  151.   +------------------------------------------------------------------------+
  152.  
  153. DOOM note : this structure is quite similar to that of a WAD file, the small
  154.             difference is that in WADS the MASTERN field is at the beginning
  155.             of the file, between WAD_MAGIC and MASTERX.
  156.  
  157. UNKNOWNS  : NONE
  158.  
  159. +----------------+
  160. |  2. LEV FILES  |
  161. +----------------+
  162.  
  163. LEV files contain a complete level geometry. They are in a very understandable
  164. but quite complex text format. They are also huge (generally > 600K).
  165. This isn't a problem, as you really cannot edit them as a text file, because of
  166. the many dependencies between the geometry elements.
  167.  
  168. 2.1. BASICS
  169.      ______
  170.  
  171.      Geometry elements are :
  172.  
  173.       -VERTEX  : a point in a 2 dimension projection (X and Z)
  174.       -WALLS   : a line joining 2 vertices
  175.       -SECTOR  : a collection of walls
  176.                  generally closed but this isn't mandatory
  177.                  can contain "gaps" or other sectors
  178.  
  179.      As the game works with a two dimension projection, the third (Y)
  180.      dimension is coded at the sector level by a floor altitude and a ceiling
  181.      altitude. Note that this imply that floors and ceilings are always FLAT.
  182.  
  183.      Sectors can however be layered on top of one another to give a "full 3D"
  184.      feeling. This is a whole new concept for DOOM levels designers.
  185.  
  186.      Each sector is coded with its walls and vertices, and is completely self
  187.      contained (there is no DOOM like vertex and linedef sharing).
  188.      The relation between sectors is done at the wall level by the
  189.      adjoin/mirror/walk mechanism.
  190.  
  191.  
  192.      1--------2      Sector 1 has 5 vertices (0 to 4) marked 0 1 2 A B
  193.      |        |                   5 walls    including AB (wall 3)
  194.      |   S1   |
  195.      |        |      Sector 2 has 4 vertices (0 to 3) marked 0 1 B A
  196.      0---B====A                   4 walls    including BA (wall 2)
  197.          | S2 |
  198.          1----0
  199.  
  200.  
  201.      It is VERY important to note that there are 2 vertices at point A,
  202.      two vertices at point B and 2 walls marked ==== . As I said above,
  203.      sectors are self contained.
  204.  
  205.      So, to come back to the adjoin/mirror/walk mechanism, if S1 and S2
  206.      must be connected, an adjoin/mirror relation must be established.
  207.  
  208.      +----1---+
  209.      |        |
  210.      0        2
  211.      | 4    3 |
  212.      +---+====+
  213.          1  2 3
  214.          +--0-+
  215.  
  216.      This is quite simple : the adjoin is the number of the connected sector,
  217.      and the mirror is the number of the connexion wall.
  218.  
  219.      So we would need to set
  220.       - in S1 : W3.adjoin = S2 and W3.mirror = 2    AND
  221.       - in S2 : W2.adjoin = S1 and W2.mirror = 3
  222.  
  223.      For the walk values, we would need to set
  224.       - in S1 : W3.walk = S2
  225.       - in S2 : W2.walk = S1
  226.  
  227.      Just to be complete, if there is no adjoin/mirror/walk, the value is -1.
  228.  
  229.      Note to DOOM designers : there is no node building to do on these levels.
  230.      This is done at each load of the level by the DF exe and is very fast.
  231.  
  232.      Correction to this: I'm not sure that a BSP is done at all !
  233.      There certainly are checks at level loading time, but a few tests on
  234.      complicated sectors seem to show 'errors' in texturing or HOM problems.
  235.      In fact, it seems that big non-convex sectors are problematic.
  236.      Maybe you just have to try and create a few 'more convex' sectors instead.
  237.      If you want to create a BSP for LEV files, don't forget you cannot split
  238.      elevators nor change the walls numbers (triggers), so good luck !
  239.      More on this later.
  240.  
  241.  
  242.      A quick note on MID, TOP and BOT textures:
  243.  
  244.      When you have adjacent sectors:
  245.          TOP  is  ABOVE the ceiling of the other SC
  246.          BOT  is  BELOW the floor   of the other SC
  247.          MID  is  everywhere you can see through to the other SC
  248.  
  249.      Of course, the MID texture is not shown when walls are adjoined, so that
  250.      you can see through! (Note: WL flag 3, bit 1 forces it back in place)
  251.  
  252.      This is exactly the same as DOOM texturing, just note that there are two
  253.      different walls, not one linedef with two sidedefs.
  254.  
  255.  
  256. 2.2. FILE DESCRIPTION
  257.      ________________
  258.  
  259.      The LEV file is composed of 4 parts :
  260.       - magic and version number
  261.       - general level info
  262.       - texture table
  263.       - geometry description ie sectors, walls, vertices data
  264.  
  265.      The following comments are accepted:
  266.  
  267.      # comment
  268.      DATA # comment
  269.  
  270.  
  271. 2.2.1. Magic and version number
  272.        ------------------------
  273.  
  274.        This is trivial.
  275.  
  276.      | LEV 2.1
  277.  
  278. 2.2.2. General Level Info
  279.        ------------------
  280.  
  281.        This part contains the following data (sample from secbase.lev):
  282.  
  283.      | LEVELNAME SECBASE
  284.      | PALETTE   SECBASE.PAL
  285.      | MUSIC     AVENGE.GMD
  286.      | PARALLAX  1024.0000 1024.0000
  287.  
  288.        After a little testing, it seems that LEVELNAME, PALETTE and MUSIC aren't
  289.        used at all by DF. (I even cannot find AVENGE.GMD !)
  290.  
  291.        [NEW]
  292.        PARALLAX determines how much the "exterior" backgrounds scroll as you
  293.        turn. 1024 1024 means as you turn around 360 degrees, you will see
  294.        1024 pixel columns of background sky. Vertical PARALLAX is similar,
  295.        although of course you can't pitch 360 degrees in DF.
  296.  
  297. 2.2.3. Texture Table
  298.        -------------
  299.  
  300.        As there is a lot of TX information in a level, a texture table is
  301.        created to avoid storing TX names in full at each occurrence.
  302.  
  303.        Coding sample :
  304.  
  305.      | TEXTURES 85         # number of textures
  306.      |  TEXTURE: TEX00.BM  # texture 0
  307.      |  TEXTURE: TEX01.BM  # texture 1
  308.      |  ...
  309.      |  TEXTURE: TEX84.BM  # texture 84
  310.  
  311.        Afterwards, all the TXs are refered to by their 0 based index in this
  312.        texture table.
  313.  
  314.  
  315. 2.2.4. Geometry description
  316.        --------------------
  317.        The first data is the total number of sectors in the level :
  318.  
  319.      | NUMSECTORS number_of_sectors
  320.  
  321.        Then each sector is described, with its vertices and walls.
  322.        Please note that the wall data is on ONE line, but has been splitted
  323.        here for visual convenience.
  324.  
  325.      | SECTOR scnum
  326.      |  NAME             sector_name
  327.      |  AMBIENT          20
  328.      |  FLOOR TEXTURE    80 -0.38 -0.06 2
  329.      |  FLOOR ALTITUDE    0.00
  330.      |  CEILING TEXTURE  0  0.00  0.00 2
  331.      |  CEILING ALTITUDE -12.00
  332.      |  SECOND ALTITUDE   0.00
  333.      |  FLAGS            0 0 0
  334.      |  LAYER            1
  335.      |
  336.      | VERTICES vxnum
  337.      |  X: 252.00 Z: 224.00 # a vx
  338.      |  ...
  339.      |
  340.      | WALLS wlnum
  341.      |  WALL LEFT:  0 RIGHT:  1 
  342.      \       MID:   0  0.00  0.00 0
  343.      \       TOP:   1  0.00  0.00 0
  344.      \       BOT:   2  0.17  0.00 0
  345.      \       SIGN: -1  0.00  0.00
  346.      \       ADJOIN: 57 MIRROR: 0 WALK: 57
  347.      \       FLAGS: 0 0 0
  348.      \       LIGHT: 5
  349.      |  ...
  350.  
  351.  
  352.        Hmmm... heavy information!
  353.        Let's take it line by line, it's not too difficult.
  354.  
  355.      | SECTOR scnum
  356.  
  357.        This is the sector number, it is zero based.
  358.  
  359.      |  NAME             sector_name
  360.  
  361.        This is both a link to the .INF file and a useful reminder.
  362.  
  363.      |  AMBIENT          20
  364.  
  365.        Ambient light level in this sector.
  366.  
  367.      |  FLOOR TEXTURE    80 -0.38 -0.06 2
  368.  
  369.        The TX to apply to the floor of the SC as an index in the TX table.
  370.        The following two floats are the X and Z offsets by which the TX must
  371.        be moved before being mapped.
  372.        The third (int) value is unknown.
  373.        It seems that floor textures must be 64x64, or the game engine does
  374.        strange things.
  375.  
  376.      |  FLOOR ALTITUDE    0.00
  377.  
  378.        The altitude of the floor of this SC. Note that the Y axis goes "down",
  379.        so higher altitudes have lower values.
  380.  
  381.      |  CEILING TEXTURE  0  0.00  0.00 2
  382.      |  CEILING ALTITUDE -12.00
  383.  
  384.        Same as floor.
  385.  
  386.      |  SECOND ALTITUDE   0.00
  387.  
  388.        This is used to indicate a second "floor" altitude in a sector.
  389.        For instance, a second altitude of 4 will make you "enter into the floor"
  390.        4 deep. It will in addition make the sector waterlike and generate a
  391.        splashing sound.
  392.        If you set a negative second altitude, you will be able to walk higher on
  393.        the sector, provided you also enter the sector higher. This is the way
  394.        platforms are created (the platform object is only a visual clue).
  395.  
  396.      |  FLAGS            0 0 0
  397.  
  398.        Three flags, the second of which is never used in the 14 original levels.
  399.        Change various things in the sector. - Described below.
  400.  
  401.      |  LAYER            1
  402.  
  403.        The layer on which the SC is (positive, 0 or negative).
  404.        This value is used in the game to make different maps corresponding to
  405.        zones of altitude.
  406.        Note that this is only a logical grouping.
  407.  
  408.  
  409.      | VERTICES vxnum
  410.  
  411.        This is the number of vertices that this SC has.
  412.  
  413.      |  X: 252.00 Z: 224.00 # a vx
  414.  
  415.        List of the VXs. X and Z are trivial.
  416.  
  417.      | WALLS wlnum
  418.  
  419.        This is the number of walls that this SC has.
  420.  
  421.  
  422.      \  WALL LEFT:  0 RIGHT:  1
  423.  
  424.        These are the origin and destination vertices for this wall.
  425.  
  426.      \       MID:   0  0.00  0.00 0
  427.  
  428.        The TX to apply to the middle of the WL as an index in the TX table.
  429.        The following two floats are the X and Y offsets by which the TX must
  430.        be moved before being mapped (remember Y goes down).
  431.        The third (int) value is unknown.
  432.  
  433.      \       TOP:   1  0.00  0.00 0
  434.  
  435.        The TX to apply to the top of the WL as an index in the TX table.
  436.        The following two floats are the X and Y offsets by which the TX must
  437.        be moved before being mapped (remember Y goes down).
  438.        The third (int) value is unknown.
  439.  
  440.      \       BOT:   2  0.17  0.00 0
  441.  
  442.        The TX to apply to the bottom of the WL as an index in the TX table.
  443.        The following two floats are the X and Y offsets by which the TX must
  444.        be moved before being mapped (remember Y goes down).
  445.        The third (int) value is unknown.
  446.  
  447.      \       SIGN: -1  0.00  0.00
  448.  
  449.        A sign is a second TX on the same WL, its main use is to place switches.
  450.        First is the TX to apply to a sign on the WL as an index in the TX table.
  451.        The following two floats are the X and Y offsets by which the TX must
  452.        be moved before being mapped (remember Y goes down). Also note that this
  453.        is relative to the texturing of the wall. So if you offset the WALL, you
  454.        have to add this offset to that of the SIGN.
  455.  
  456.      \       ADJOIN: 57 MIRROR: 0 WALK: 57
  457.  
  458.        See the BASICS section.
  459.  
  460.      \       FLAGS: 0 0 0
  461.  
  462.        Three flags.
  463.        Change various things in the wall. - Described below.
  464.  
  465.      \       LIGHT: 5
  466.  
  467.        Relative modification of the luminosity on this specific WL.
  468.  
  469.  
  470.        So this is it for the LEV files. As you can see, it is totally
  471.        impossible to edit as text, except perhaps to change a TX name in the
  472.        TX table, which is an ultra fast way to relook a level !
  473.  
  474.  
  475. UNKNOWNS  : PARALLAX
  476.             the int value after textures offsets
  477.  
  478. +----------------+
  479. |  3. FLAGS      |
  480. +----------------+
  481.  
  482. These are the currently known values for the various sector and wall flags.
  483.  
  484. 3.1. SECTOR FLAGS
  485.      ------------
  486.  
  487.      * FLAG 1
  488.  
  489.      +-----------------------------------+
  490.      |      1 EXTERIOR - NO CEIL.  (SKY) |
  491.      |      2 DOOR                       | instant door
  492.      |      4 SHOT REFLEXION / MAG.SEAL  | walls reflect weapon shots
  493.      |      8 EXTERIOR ADJOIN            | for adjacent skys with != alt.
  494.      |     16 ICE FLOOR        (SKATING) |
  495.      |     32 SNOW FLOOR                 |
  496.      |     64 EXPLODING WALL/DOOR        | instant exploding door
  497.      |    128 EXTERIOR - NO FLOOR  (PIT) |
  498.      |    256 EXTERIOR FLOOR ADJOIN      | for adjacent pits with != alt.
  499.      |    512 CRUSHING SECTOR            |
  500.      |   1024 NO WALL DRAW / "HORIZON"   | horizon moves with eye level
  501.      |   2048 LOW  DAMAGE                |
  502.      |   4096 HIGH DAMAGE   (both = GAS) | both can be combined for GAS
  503.      |   8192 NO SMART OBJECT REACTION   |
  504.      |  16384 SMART OBJECT REACTION      |
  505.      |  32768 SUBSECTOR                  | player won't follow moving SC
  506.      |  65536 SAFE SECTOR                |
  507.      | 131072 RENDERED     (do not use!) |
  508.      | 262144 PLAYER       (do not use!) |
  509.      | 524288 SECRET SECTOR              | increments the %secret when entered
  510.      +-----------------------------------+
  511.  
  512.      * FLAG 2 isn't used in the 14 original levels.
  513.  
  514.      * FLAG 3 only serves as an extra lighting value in TALAY.
  515.  
  516.  
  517. 3.2. WALL FLAGS
  518.      ----------
  519.  
  520.      * FLAG 1
  521.      +-----------------------------------+
  522.      |     1 ADJOINING MID TX            | the MID TX is NOT removed
  523.      |     2 ILLUMINATED SIGN            |
  524.      |     4 FLIP TEXTURE HORIZONTALLY   |
  525.      |     8 ELEV CAN CHANGE WALL LIGHT  |
  526.      |    16 WALL TX ANCHORED            |
  527.      |    32 WALL MORPH WITH SECTOR      |
  528.      |    64 ALLOW SCROLL TOP  TX        |
  529.      |   128 ALLOW SCROLL MID  TX        |
  530.      |   256 ALLOW SCROLL BOT  TX        |
  531.      |   512 ALLOW SCROLL SIGN TX        |
  532.      |  1024 HIDE ON MAP                 |
  533.      |  2048 SHOW ON MAP                 |
  534.      |  4096 SIGN ANCHORED               |
  535.      |  8192 WALL DAMAGES PLAYER         |
  536.      | 16384 SHOW AS LEDGE ON MAP        |
  537.      | 32768 SHOW AS DOOR  ON MAP        |
  538.      +-----------------------------------+
  539.  
  540.      * FLAG 2 is unused.
  541.  
  542.      * FLAG 3
  543.      +-----------------------------------+
  544.      |     1 CAN ALWAYS WALK             |
  545.      |     2 CANNOT WALK THROUGH WALL    |
  546.      |     4 FENCE - KEEP ENNEMIES IN    |
  547.      |     8 CANNOT FIRE THROUGH WALL    |
  548.      +-----------------------------------+
  549.  
  550. +----------------+
  551. |  4. INF FILES  |
  552. +----------------+
  553.  
  554. INF files are text files written in "the INF programming language".
  555. They accept C like  /* */  comments.
  556. They are linked to the SCs via the SC names, and
  557.                 to the WLs via the SC names and WL number.
  558.  
  559. The basic items defined in the .INF are
  560.  - triggers  : * they trigger something in their 'clients'.
  561.  - elevators : * they receive messages and act upon them,
  562.                  possibly sending other messages, and so on.
  563.                * they may also have 'slaves' following their every action.
  564.  
  565. Elevators are to be taken very widely :
  566.      elevator basic
  567.      elevator change_light
  568.      elevator change_wall_light
  569.      elevator door
  570.      elevator door_mid
  571.      elevator inv
  572.      elevator morph_move1
  573.      elevator morph_move2
  574.      elevator morph_spin1
  575.      elevator morph_spin2
  576.      elevator move_ceiling
  577.      elevator move_fc       (floor and ceiling together use @ stops !)
  578.      elevator move_floor
  579.      elevator rotate_wall
  580.      elevator scroll_ceiling
  581.      elevator scroll_floor
  582.      elevator scroll_wall
  583.      elevator teleporter chute [NEW]
  584.  
  585. The variables in the language are the positions of the elevators created by
  586. the programmer (a lot of them in "dummy" (ie never accessible) sectors).
  587. Those positions are marked by 'stop:' keywords. The values following may be
  588. absolute or relative in which case they are prepended with a '@'. Note that
  589. the 'stop' unit is dependent of the elevator type. It may be floor altitude,
  590. ceiling altitude, ambient or light level, degrees ...
  591.  
  592. The whole thing works by triggering/sending messages across the items and
  593. reacting to them differently depending on the "variables". Other actions can
  594. also be executed, such as adjoining, terminating, pausing and waking up (OB),
  595. playing a sound, playing an animation, ...
  596.  
  597. Here is a quick list of some of the messages :
  598.      [stop] [sector]
  599.      [stop] [sector[(wall)]] clear_bits            flagnum bitnum
  600.      [stop] [sector]         complete              num
  601.      [stop] [sector[(wall)]  done
  602.      [stop] [sector]         goto_stop             num
  603.      [stop] [sector]         master_on             [value]
  604.      [stop] [sector]         master_off            [value]
  605.      [stop] [sector[(wall)]] m_trigger             [value]
  606.      [stop] [sector]         next_stop
  607.      [stop] [sector]         prev_stop
  608.      [stop] [sector[(wall)]] set_bits              flagnum bitnum
  609.      [stop] [sector]         wakeup
  610.      [stop] system           lights            (in TALAY uses SC flag 3)
  611.      trigger                           ??      (in FUELSTAT.INF line 391)
  612.  
  613. The [stop] is the stop at which the message will be send. 
  614. So when you look at an INF file and you see something like :
  615.  
  616.    class: elevator EEEEEE
  617.     stop: 0
  618.           message: 0 MMMMMM
  619.     stop: 1
  620.           message: 1 MMMMMM
  621.  
  622. it's only a visual clue, and you could group all the messages in one place and
  623. in any order. Important : if you add a stop, you may have to renum !
  624.  
  625. Note that the elevators START at their stop 0, but the messages are send when
  626. the elevators ARRIVE at a stop. So the messages set up at stop 0 won't be
  627. send at level startup.
  628.  
  629. And a list of the triggers :
  630.      trigger
  631.      trigger single
  632.      trigger switch1
  633.      trigger standard
  634.      trigger toggle
  635.  
  636. The triggers react only to determinate events : this is called the event_mask.
  637. Some possible values follow :
  638.  
  639.        1 WALK FROM INSIDE          ( line   trigger )
  640.        2 WALK FROM OUTSIDE         ( line   trigger )
  641.        4 ENTER SECTOR              ( sector trigger )
  642.        8 LEAVE SECTOR              ( sector trigger )
  643.       16 NUDGE FROM INSIDE         ( sector / line  )
  644.       32 NUDGE FROM OUTSIDE        ( sector / line  )
  645.       64 ??
  646.      128 ??
  647.      256 FIRE                      ( line trigger with entity_mask: 8 )
  648.      512 ?? used once in ARC.INF
  649.  
  650. If you want to use a 'fire on it' trigger, you have to change the
  651. entity_mask (ie what do you use to trigger) to 8.
  652. If you want to both fire and nudge for instance, use entity_mask: *
  653.  
  654. The programming language is a little object oriented like, as you have default
  655. items in which you override only the fields you need. It is very powerful, and
  656. lets you to a certain extent dynamically modify the level.
  657.  
  658. Here are some basic values (of course, not all elevators have them all!) :
  659.      MASTER      (master item switch : may be on or off)
  660.      EVENT_MASK
  661.      SPEED
  662.      CENTER
  663.      ANGLE
  664.  
  665. As I don't have the time to compile a formal definition of the language, I give
  666. you the following advise : use a GREP like utility to generate a list of
  667. triggers, messages and elevators from all the .INF in the game, complete with
  668. filename and line numbers. This will make you a "reference" very useful to go
  669. and see how the LEC programmers do it.
  670.  
  671. Note : don't forget to change the 'items' value when you modify an INF.
  672.  
  673. To DOOM level makers : this may seem complicated, but I remember a WAD of mine
  674. with a long corridor with 19 consecutive linedefs doing modifications to the
  675. look of the level... then I remember spacing the linedefs so that some actions
  676. where finished before some others... then the player ran in the corridor...
  677.  
  678.  
  679. UNKNOWNS  : FORMAL FULL DESCRIPTION
  680.  
  681. +----------------+
  682. |  5. GOL FILES  |
  683. +----------------+
  684.  
  685. GOL files contain a description of what to do to complete the levels.
  686.  
  687. Sample code:
  688.  
  689.      | GOL 1.0
  690.      | GOAL: 0       ITEM:   5       # DT weapon
  691.      | GOAL: 1       TRIG:   1
  692.  
  693. Each GOAL: can be a TRIG: to fire or an ITEM: to take.
  694.  
  695. 'Goal triggers' are fired in the .INF file with the 'complete num' keyword sent
  696. to the complete sector (don't get confused here!).
  697.  
  698. For instance,   " message: s complete complete 1 "
  699. will say that TRIG: 1 is complete!
  700.  
  701.  
  702. 'Goal objects' fire internal triggers because of their logic. That internal
  703. trigger seems to be equivalent to " message: s complete next_stop "
  704. So, be sure that complete is at a correct hold point when the object is taken.
  705. Try to do nothing else in complete than handling the goals.
  706. If necessary, start another 'level control' elevator very early.
  707.  
  708. Object numbers are in an internal table at runtime.
  709. The broken Dark Trooper weapon for instance has the number 5 (see TALAY.GOL).
  710. If you want to make the player retrieve it in a SECBASE modification, just
  711. change the value of item to 5 in SECBASE.GOL (don't forget to put this object
  712. in your .O file).
  713. The message on the screen will be correct because the object has
  714. LOGIC: DT_WEAPON, and your OBJectives screen will be updated.
  715. But note that it still says 'retrieve death star plans'. Changing that means
  716. understanding the lfd format (which is most probably graphical !).
  717.  
  718. Here are the screen messages associated with the goal objects, you can patch
  719. them in text.msg .
  720.  
  721.      | 400  1:  "Death Star Plans"       for object 0
  722.      | 401  1:  "Phrik Metal"            for object 1
  723.      | 402  1:  "Nava Card"              for object 2
  724.      | 405  1:  "Dark Trooper Weapon"    for object 5
  725.      | 406  1:  "Data Tape"              for object 4
  726.  
  727. Object 6 is 'Your Gear' as used in the JABSHIP level and has the text
  728.  
  729.      | 312  1:  "Your Gear"
  730.  
  731. in the 'Power-Up Pickup Messages' section of the same text.msg file.
  732.  
  733.  
  734. Final note: don't assume the goals will happen in the .GOL order !
  735.  
  736.  
  737. +----------------+
  738. |  6. O   FILES  |
  739. +----------------+
  740.  
  741. O files contain all the level objects.
  742. They are in a very understandable but a little complex text format.
  743. They accept C like  /* */  comments.
  744.  
  745. 6.1. BASICS
  746.      ______
  747.  
  748.      There are many different object types in Dark Forces:
  749.  
  750.       - SPIRIT : an object not linked to a viewable file (ie invisible)
  751.                  Its main use is for the PLAYER, but you can create other
  752.                  invisible items. [NEW]
  753.       - SAFE   : a restart point after the player died.
  754.                  You should put SAFEs in your levels, to allow the player to
  755.                  restart not far from where he died, but also because it seems
  756.                  to be the best bet as 'player starting points' if LEC produces
  757.                  a multiplayer version. (Put 8+ of them so you'll be ... safe!)
  758.       - SPRITE : fully animated objects such as ennemies.
  759.       - FRAME  : "one view" objects such as energy power ups.
  760.       - 3D     : 3D objects such as mousebots.
  761.       - SOUND  : an ambient sound around the object position.
  762.  
  763. 6.2. FILE DESCRIPTION
  764.      ________________
  765.  
  766.      The O file is composed of 4 parts :
  767.       - magic and version number
  768.       - level name
  769.       - objects tables
  770.       - object descriptions
  771.  
  772.  
  773. 6.2.1. Magic and version number
  774.        ------------------------
  775.  
  776.        This is trivial.
  777.  
  778.      | O 1.1
  779.  
  780. 6.2.2. Level Name
  781.        ----------
  782.  
  783.      | LEVELNAME SECBASE
  784.  
  785.        I'm not sure this is used in DF !
  786.  
  787. 6.2.3. Object tables
  788.        -------------
  789.  
  790.        As there is a lot of OB information in a level, 4 object tables are
  791.        created to avoid storing OB names in full at each occurrence.
  792.  
  793.        Coding sample :
  794.  
  795.  
  796.      | PODS 3             # These are the "3D" objects
  797.      |  POD: DEATH.3DO    # 00
  798.      |  ...
  799.      |
  800.      | SPRS 10
  801.      |  SPR: OFFCFIN.WAX  # 00
  802.      |   ...
  803.      |
  804.      | FMES 6
  805.      |  FME: IENERGY.FME  # 00
  806.      |  ...
  807.      |
  808.      | SOUNDS 1
  809.      |  SOUND: BANG.VOC  #00
  810.      |  ...
  811.  
  812.        Afterwards, all the OBs are refered to by their 0 based index in the
  813.        object tables. The object CLASS determines in which table to look.
  814.  
  815. 6.2.4. Object descriptions
  816.        -------------------
  817.  
  818.        The first data is the total number of objects in the level :
  819.  
  820.      | OBJECTS 185
  821.  
  822.        Then each object is described.
  823.        Please note that the object data first line has been splitted here for
  824.        visual convenience.
  825.  
  826.      | CLASS: SPIRIT       DATA:  0 X: 131.00 Y:   0.00 Z: 210.00
  827.                                   PCH:   0.00 YAW: 176.34 ROL:   0.00
  828.                                   DIFF: 1
  829.      |  SEQ
  830.      |   LOGIC:     PLAYER
  831.      |   EYE:       TRUE
  832.      |  SEQEND
  833.      |
  834.      | CLASS: SPRITE       DATA:  0 X: 320.62 Y:  20.00 Z: 275.64
  835.      \                            PCH:   0.00 YAW: 270.00 ROL:   0.00
  836.      \                            DIFF: 1
  837.      |  SEQ
  838.      |   TYPE:      I_OFFICER
  839.      |  SEQEND
  840.  
  841.        This is quite easy : CLASS is the type of object, and DATA is the
  842.        offset in the corresponding object table (SPIRIT and SAFE have DATA = 0).
  843.  
  844.        X, Y, Z are trivial.
  845.  
  846.        PCH, YAW, ROL are classic spatial orientation, but only YAW is really
  847.        used (DOOM equivalent is THING orientation). It takes a value in degrees
  848.        where 0 is at the "top of the screen when you look at the map". The
  849.        value increases clockwise.
  850.  
  851.        DIFF is the difficulty level at which the object appears.
  852.  
  853.         +------+------------------+
  854.         | DIFF | EASY   MED  HARD |
  855.         +------+------------------+
  856.         |  -3  |   X     X     X  |
  857.         |  -2  |   X     X        |
  858.         |  -1  |   X              |
  859.         |   0  |   X     X     X  |
  860.         |   1  |   X     X     X  |
  861.         |   2  |         X     X  |
  862.         |   3  |               X  |
  863.         +------+------------------+
  864.  
  865.        SEQ and SEQEND are delimiters for a series of options/modifiers to apply
  866.        to the object. They determine part of its behaviour ( LOGIC: ).
  867.        For instance, if you take a mousebot and set it the LOGIC:  of a
  868.        stormtrooper, you'll end up with an unmoving lifeless mousebot.
  869.  
  870.        [NEW]
  871.        It seems that the keywords TYPE: and LOGIC: are freely swappable, as are
  872.        UPDATE and ANIM, and that the ITEM keyword is optional, but this has to
  873.        be tested fully.
  874.        Note that the same viewable file may be used to create 'different'
  875.        objects. For instance, OFFCFIN.WAX may be used with a TYPE: I_OFFICER
  876.        or TYPE: I_OFFICERR (note the second 'R') which will generate a red key
  877.        when killed.
  878.  
  879.        The other use of this is to create object generators.
  880.        Here is a quite self explaining sample:
  881.  
  882.  
  883.      | CLASS: SPRITE       DATA:  4 X: 396.88 Y:  -2.00 Z: 217.48
  884.      \                            PCH:   0.00 YAW:   0.00 ROL:   0.00 DIFF: 1
  885.      |  SEQ
  886.      |   LOGIC:     GENERATOR STORM1
  887.      |   DELAY:     0
  888.      |   INTERVAL:  20
  889.      |   MAX_ALIVE: 1
  890.      |   MAX_DIST:  200
  891.      |   MIN_DIST:  70
  892.      |   NUM_TERMINATE: 3
  893.      |  SEQEND
  894.  
  895.       What is not clear is WHEN they are generated. What I know is that they
  896.       are never generated while you look directly at the generator !
  897.       Also note that you can set MASTER: OFF on a generator, and activate it
  898.       by sending a message: s master_on to the sector that contains it. [NEW]
  899.  
  900.       [NEW] I set as unknown the workings of the KYL3DO object in the previous
  901.       specs, but it works perfectly well. You just have to use the same
  902.       coordinates as they are hardcoded !
  903.  
  904. UNKNOWNS  : FORMAL FULL DESCRIPTION
  905.             exact generator workings
  906.  
  907.  
  908. +----------------+
  909. |  7. PAL FILES  |
  910. +----------------+
  911.  
  912. PAL files store a single 256 colors palette as 256 x 3 RGB bytes.
  913. Each level can have its own palette.
  914.  
  915. UNKNOWNS  : NONE
  916.  
  917.  
  918. +----------------+
  919. |  8. CMP FILES  |
  920. +----------------+
  921.  
  922. CMP file seem to store palette mappings (like DOOM COLORMAP).
  923. They contain 32 times 256 bytes for light levels 0 to 31.
  924.  
  925. Note that colors from 0 to 31 are never modified. Keep this in mind if you
  926. design textures. They can follow the lights or not at your own convenience.
  927.  
  928. There are 128 other unknown bytes at the end of the file forming a slow
  929. gradient from 0x00 to 0x1F. I don't know what they are for.
  930.  
  931.  
  932. +----------------+
  933. |  9. BM  FILES  |
  934. +----------------+
  935.  
  936. Here is the C structure for the BM file header.
  937.  
  938. struct BM_header
  939. {
  940.  char      MAGIC[4];
  941.  int       SizeX;           /* if X = 1 then multiple BM in the file */
  942.  int       SizeY;           
  943.  int       idemX;
  944.  int       idemY;
  945.  byte      transparent;     /* 0x36 for normal, 0x3E for transparent */
  946.  byte      logSizeY;        /* ie logSizeY = log2(SizeY)             */
  947.  int       Compressed;      /* 0 = not compressed, 1 = compressed    */
  948.  long      DataSize;        /* excluding header                      */
  949.  char      filler[12];
  950. };
  951.  
  952. Please note that BMs must have a height which is a power of 2.
  953.  
  954. The data follows, encoded by COLUMNS from the bottom to the top.
  955.  
  956. Transparent BMs :
  957. ---------------
  958.  
  959. You can transform any BM in a 'transparent' BM by changing its transparent
  960. value from 0x36 to 0x3E. The color 0 will 'disappear'.
  961. Note that this isn't the same color as the one used in DOOM transparent
  962. textures (cyan in the DOOM palette).
  963.  
  964. Multiple BMs    :
  965. ------------
  966.  
  967. If SizeX == 1 BM file contains idemY BMs.
  968. There follow two bytes, the first of which permits to distinguish between
  969. 'switches' (if == 0) and 'animated textures'. It is the speed of animation
  970. (maybe in frames per second). You may alter this value if you want to.
  971. The second is 2.
  972. Then follows a table of offsets to the 'sub' BMs composed of idemY BMs.
  973. Each 'sub' BM then has its own header WITHOUT the MAGIC field (ie 28 bytes),
  974. with some slight modifications (I'll check later!).
  975.  
  976. Important note: for a multiple BM to work correctly, it must be made a 'SIGN',
  977. AND for switches there MUST also exist a corresponding trigger in the .INF
  978. Else, switches will be displayed wrong (as a single column) and the animated
  979. will display correctly, but static. This means that you cannot do animated
  980. floors and ceilings this way!
  981.  
  982.  
  983. Compressed BMs  :
  984. --------------
  985.  
  986. If compressed == 1  BM is compressed.
  987. These existed in the DEMO (buyit.bm), but I'm not sure if there are any in the
  988. full game. They use a mixed direct/RLE coding. In the demo, wait.bm also used
  989. yet another coding, but it's a perfectly normal BM in the full game.
  990.  
  991. Here we go. Fasten seat belts!
  992.  
  993. The heart of the data is a 'columns starts' table, with the start addresses of
  994. each of the columns. It is at the end of the file, at offset DataSize,
  995. and has one long entry per column containing this column start address.
  996. This start address is calculated without the 32 bytes BM header
  997. (ie read the header in a struct, then the data in a HUGE buffer at offset 0).
  998.  
  999. The coding of one column follows (in a pseudo pseudocode format!).
  1000.  
  1001.  while(end of data for this column not reached)
  1002.  {
  1003.   if(buffer[adr] <= 128)
  1004.     the FOLLOWING n bytes are direct values
  1005.   else
  1006.     the FOLLOWING byte is a color byte to repeat n-128 times
  1007.  }
  1008.  
  1009. There was an 0xFF last byte marker per column. However,I do prefer to
  1010. calculate the end of the column data by using the start of next column, as
  1011. this is more like the FME and WAX reading technique.
  1012.  
  1013. A slight variation of this compression is used in the frames and the sprites.
  1014.  
  1015. You may unfasten your seat belts!
  1016.  
  1017.  
  1018. +----------------+
  1019. | 10. FME FILES  |
  1020. +----------------+
  1021.  
  1022. Contains the frames, which are the "one view" objects
  1023. (you can turn around them, and always see the same image).
  1024.  
  1025. Here are the C structures for the FME file headers.
  1026.  
  1027. struct FME_header1
  1028. {
  1029.  long  u1;
  1030.  long  u2;
  1031.  long  u3;
  1032.  long  header2;         /* this is the absolute adress of header2 */
  1033.  char  unknown[16];
  1034. }
  1035.  
  1036. struct FME_header2
  1037. {
  1038.  int   SizeX;
  1039.  int   u1;
  1040.  int   SizeY;
  1041.  int   u2;
  1042.  int   Compressed;
  1043.  int   u3;
  1044.  long  DataSize;
  1045.  char  fil[8];
  1046. };
  1047.  
  1048. There are at least two formats for these.
  1049. If Compressed == 0 the format it very similar to the BM format, with just the
  1050. header rearranged.
  1051. The header 1 is totaly unknown except for the field header2.
  1052. The header 2 contains the X and Y sizes, and the data follows, encoded
  1053. by COLUMNS from the bottom to the top.
  1054.  
  1055. With Compressed == 1, the format looks like the compressed BM used in the demo
  1056. level, also with the header modifications (see).
  1057.  
  1058. Four differences :
  1059.  * the 'column starts' table is at the top of the file, just after the header.
  1060.  * you have to offset the adresses by -24 (they counted only header 1 ?)
  1061.  * the end of column data marker isn't there.
  1062.  * the backgroud color is always 0 (transparent) and ISN'T CODED.
  1063.    (there was a color byte in the BM compressed format).
  1064.  
  1065. There are two negative longs right at the beginning of header 1 that I don't
  1066. understand.
  1067.  
  1068. UNKNOWNS  : what's in FME_header1
  1069.  
  1070.  
  1071. +----------------+
  1072. | 11. WAX FILES  |
  1073. +----------------+
  1074.  
  1075. Contains the sprites.
  1076. (samples : STORMTROOPERS, BONUS LIVES ...)
  1077.  
  1078. These are a collection of embedded FME files. They contain a table with
  1079. 32 entries (offset to first entry = 0x000000BC). Each of these entry points to
  1080. a table containing adresses of a complete embedded enhanced FME file.
  1081. Take care to read that one properly (ie using the header2 offset in header1)
  1082. as there are multiple consecutive header1 !
  1083.  
  1084. As I began to wrote a viewer for these, I tried all the 32 first table entries
  1085. for a few waxes. Though they followed a different path through the pointers in
  1086. the file, I always get the same image ??? I'll try to find more later.
  1087.  
  1088. UNKNOWNS  : exact FILE FORMAT and details
  1089.  
  1090.  
  1091. +----------------+
  1092. | 12. 3DO FILES  |
  1093. +----------------+
  1094.  
  1095. Contains the "3D" objects.
  1096. (samples : MOUSEBOT, the DEATH STAR HOLOGRAM, ...)
  1097.  
  1098. These are text files containing a geometric description of a full 3D object.
  1099. I really don't have time now, but it should be quite easy to understand.
  1100.  
  1101. UNKNOWNS  : everything!
  1102.  
  1103. +----------------+
  1104. | 13. VOC FILES  |
  1105. +----------------+
  1106.  
  1107. Contains the sounds.
  1108. These are standard .VOC files in the Creative Labs format.
  1109.  
  1110. +----------------+
  1111. | 14. GMD FILES  | [NEW]
  1112. +----------------+
  1113.  
  1114. Contains the musics. 
  1115.  
  1116. The GMD files are SMF files type 2 (SMF = Standard Midi Files), but they've got
  1117. a different header. If you want to convert the header, you'll have to delete
  1118. everything BEFORE the string "MThd", so that the file begins with that string.
  1119. After you've done that, you can play/edit the file with any type 2 compatible
  1120. MIDI sequencer program.
  1121.  
  1122. +----------------+
  1123. | 15. MSG FILES  |
  1124. +----------------+
  1125.  
  1126. Contains the text messages used in the game.
  1127.  
  1128. local.msg contains error messages and should be left untouched.
  1129. text.msg  however can be patched. The use of this is to create new messages
  1130.           that you can use in your levels (create a trigger, use text: ttt).
  1131.  
  1132. General format:
  1133.  
  1134.      | MSG 1.0
  1135.      |
  1136.      | MSGS 119
  1137.      |
  1138.      | # internal game messages
  1139.      | 0    0:  "Joystick Off"
  1140.      | ...
  1141.      | END
  1142.  
  1143. MSGS is the number of messages. Don't forget to update it if you add messages.
  1144.  
  1145. I found no problems by adding messages at 900 and more.
  1146.  
  1147.      | 900  1:  "Hurry up !"
  1148.  
  1149. I don't know what the second number ( ie 0: ) is for. I use 1:
  1150.  
  1151. Here are also the 'cheat messages' from 700 onwards. Just so you know where to
  1152. insert a few 'Cheater!' and 'Chicken Mode ON' ...
  1153.  
  1154. +------------------+
  1155. | 16. CHEAT CODES  |
  1156. +------------------+
  1157.  
  1158. Just in case you haven't found them anywhere else !
  1159. I've also shown the equivalent cheat for DOOMers.
  1160.  
  1161. LABUG      bug mode
  1162. LACDS      map with things               (IDDT x2)
  1163. LADATA     coordinates & %secret         (IDMYPOS)
  1164. LAIMLAME   total invincibility           (IDDQD)
  1165. LANTFH     teleport to a safe
  1166. LAPOGO     allow to climb any height     (IDSPISPOPD / IDCLIP w/o walking thru)
  1167. LAPOSTAL   get weapons and ammo          (IDFA)
  1168. LARANDY    weapon super charge
  1169. LAREDLITE  freeze ennemies
  1170. LASKIP     finishes current level
  1171. LAUNLOCK   get all the keys              (the 'K' of IDKFA)
  1172.  
  1173. LAlevel    jump to level                 (IDCLEV)
  1174.